package edu.sctu.zcy.month201505.day20150506;

import java.util.Scanner;

/**
 * Created by user24 on 2015/5/7.
 */
public class SortNew {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        System.out.println("请输入待排序整数的个数：");
        int n=s.nextInt();
        int[] a=new int[n];


        int temp;
        System.out.print("请输入待排序的整数：");
        for (int i = 0; i < n; i++) {
            a[i]=s.nextInt();
        }
        System.out.println("排序结果：");
        for (int j = 0; j <a.length ; j++){
            for (int k = 0; k < a.length-1; k++) {
                if (a[k] > a[k + 1]) {
                    temp = a[k];
                    a[k] = a[k + 1];
                    a[k + 1] = temp;
                }
            }
        }
        for (int i = 0; i < n; i++)
            System.out.print(a[i]+" ");
    }

}
